home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / wtj208.zip / ZEMPEL / SOURCE / UT16 / UT16.C < prev    next >
C/C++ Source or Header  |  1993-05-08  |  2KB  |  104 lines

  1. /*
  2.     ut16.c  a 16 bit UT DLL
  3.  
  4.     UT16.DLL loaded during 32 bit UT initialization
  5.     UTProc is function that services 32 -> 16 bit thunk
  6.     16 -> 32 bit UT address is saved in CBInit
  7.  
  8.     built with QC/Win 1.0 Windows DLL, small memory model
  9.     linked with w32sut16.lib (included in NT SDK)
  10.     and calcw16.lib (16 bit test DLL library)
  11. */
  12.  
  13. #define W32SUT_16
  14.  
  15. #include <windows.h>
  16. #include "w32sut.h"
  17. #include "calcw16.h"
  18. #include "ut16.h"
  19.  
  20. UT16CBPROC  pfnCBProc;
  21. static long Ret;
  22.  
  23. #define CALC_SRV_ADDTWO         0
  24. #define CALC_SRV_SUBTWO         1
  25. #define CALC_SRV_MULTTWO        2
  26. #define CALC_SRV_DIVTWO         3
  27. #define SUM_ARRAY               4
  28.  
  29. int far pascal LibMain(HANDLE hModule, WORD wDataSeg, WORD cbHeapSize, LPSTR lpszCmdLine)
  30. {
  31.     return(TRUE);
  32. }
  33.  
  34. DWORD far pascal UTProc(long far *lpBuf, DWORD dwFunc)
  35. {
  36.  
  37.     switch (dwFunc) {
  38.  
  39.     case CALC_SRV_ADDTWO:
  40.             return(AddTwo(lpBuf));
  41.  
  42.     case CALC_SRV_SUBTWO:
  43.             return(SubTwo(lpBuf));
  44.  
  45.         case CALC_SRV_MULTTWO:
  46.             return(MultTwo(lpBuf));
  47.  
  48.         case CALC_SRV_DIVTWO:
  49.             return(DivTwo(lpBuf));
  50.     };
  51.     return(0);
  52. }
  53.  
  54.  
  55. DWORD CALLBACK CBInit(UT16CBPROC pfunction, long far *lpbuf)
  56. {
  57.     pfnCBProc=pfunction;
  58.     return(TRUE);
  59. }
  60.  
  61.  
  62. long far pascal AddTwo32(long far *Arrayn)
  63. {
  64.     Ret= (long)(* pfnCBProc)(Arrayn,CALC_SRV_ADDTWO, NULL);
  65.     return(1);
  66. }
  67.  
  68. long far pascal SubTwo32(long far *Arrayn)
  69. {
  70.     Ret= (long) (* pfnCBProc)(Arrayn,CALC_SRV_SUBTWO, NULL);
  71.     return(1);
  72. }
  73.  
  74. long far pascal MultTwo32(long far *Arrayn)
  75. {
  76.     Ret= (long) (* pfnCBProc)(Arrayn,CALC_SRV_MULTTWO, NULL);
  77.     return(1);
  78. }
  79.  
  80. long far pascal DivTwo32(long far *Arrayn)
  81. {
  82.     Ret= (long) (* pfnCBProc)(Arrayn,CALC_SRV_DIVTWO, NULL);
  83.     return(1);
  84. }
  85.  
  86. long far pascal SumArray32(long far *Arrayn)
  87. {
  88.     Ret= (long) (* pfnCBProc)(Arrayn, SUM_ARRAY, NULL);
  89.     return(1);
  90. }
  91.  
  92. long far pascal VBPTRtoLong(long far *Arrayn)
  93. {
  94.     Ret= (long)(Arrayn);
  95.     return(Ret);
  96. }
  97.  
  98. int far pascal VBLowWord(DWORD Handle)
  99. {       int LowWord;
  100.  
  101.     LowWord=LOWORD(Handle);
  102.     return(LowWord);
  103. }
  104.